package com.lc.cehui.ui.activity.mine;

import android.graphics.Color;

import com.lc.cehui.R;
import com.lc.cehui.app.AppActivity;
import com.lc.cehui.ui.adapter.TabViewPagerAdapter;
import com.lc.cehui.ui.fragment.CollectionOtherFragment;
import com.lc.cehui.ui.fragment.CollectionShopFragment;
import com.lc.cehui.widget.SlidingTabLayout;

import java.util.ArrayList;
import java.util.List;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;

public class CollectionActivity extends AppActivity {

    @BindView(R.id.slidingTabLayout)
    SlidingTabLayout slidingTabs;
    @BindView(R.id.viewpager)
    ViewPager vp;



    private List<String> titles = new ArrayList<>();

    private List<Fragment> fragments = new ArrayList<>();
    @Override
    protected int getLayoutId() {
        return R.layout.activity_collection;
    }

    @Override
    protected void initView() {

        titles.add("商品");
        titles.add("其他");
        fragments.add(CollectionShopFragment.newInstance("0"));
        fragments.add(CollectionOtherFragment.newInstance("1"));

        vp.setAdapter(new TabViewPagerAdapter(this.getSupportFragmentManager(), CollectionActivity.this,fragments,titles));
        slidingTabs.setTabTitleTextSize(13);//标题字体大小
        slidingTabs.setTitleTextColor(Color.parseColor("#028BFF"), Color.parseColor("#999999"));//标题字体颜色
        slidingTabs.setTabStripWidth(60);//滑动条宽度
        slidingTabs.setSelectedIndicatorColors(Color.parseColor("#028BFF"));//滑动条颜色
        slidingTabs.setDistributeEvenly(true); //均匀平铺选项卡
        slidingTabs.setViewPager(vp);//最后调用此方法
        vp.setOffscreenPageLimit(fragments.size());//fragment保存的个数
        vp.setCurrentItem(0);//设置卡在页面
    }

    @Override
    protected void initData() {

    }

}
